package com.txd.mofa.utils;

import android.annotation.SuppressLint;
import android.os.CountDownTimer;
import android.widget.TextView;

/**
 * Created by dell-pc on 2018/9/19.
 */

public class VerificationTimer1 extends CountDownTimer {

    private TextView textView;
    private Dianji dianji;

    /**
     * @author millisInFuture 一共的时间
     * @author countDownInterval 几秒
     * @author textView 控件可以更换你所需要的控件
     * @author one onTick方法中的背景颜色        这两个都是用于控制控件背景的
     * @author tow  onFinish 方法中的背景颜色
     */

    public VerificationTimer1(long millisInFuture, long countDownInterval, TextView textView, Dianji dianji) {
        super(millisInFuture, countDownInterval);
        this.textView = textView;
        this.dianji = dianji;


    }

    @SuppressLint("ResourceAsColor")
    @Override
    public void onTick(long millisUntilFinished) {
//        textView.setTextColor(Color.GRAY);

        textView.setText(millisUntilFinished / 1000+"s跳过");
    }

    @SuppressLint("ResourceAsColor")
    @Override
    public void onFinish() {

        dianji.tiaoguo();



    }

    public interface Dianji{
        void tiaoguo();
    }
}